﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace BeastMaster
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            BeastMasterSettings.myPrefs.Load();

            numericUpDownCDNormalMobs.Value = new decimal(BeastMasterSettings.myPrefs.cooldownNormalMobs);
            numericUpDownCDBosses.Value = new decimal(BeastMasterSettings.myPrefs.cooldownBosses);
            numericUpDown1.Value = new decimal(BeastMasterSettings.myPrefs.callpetnr);
            numericUpDown2.Value = new decimal(BeastMasterSettings.myPrefs.mendpetpercent);
            numericUpDown3.Value = new decimal(BeastMasterSettings.myPrefs.ElitesHealth);
            numericUpDown4.Value = new decimal(BeastMasterSettings.myPrefs.healthstonepercent);
            numericUpDown5.Value = new decimal(BeastMasterSettings.myPrefs.naruupercent);
            numericUpDown6.Value = new decimal(BeastMasterSettings.myPrefs.EatFood);
            numericUpDown7.Value = new decimal(BeastMasterSettings.myPrefs.startaoe);

            checkBoxMovement.Checked = BeastMasterSettings.myPrefs.Movement;
            checkBoxFacing.Checked = BeastMasterSettings.myPrefs.Facing;
            checkBoxTargeting.Checked = BeastMasterSettings.myPrefs.Targeting;
            checkBox1.Checked = BeastMasterSettings.myPrefs.UseSilencingShot;


            comboBox1.SelectedIndex = BeastMasterSettings.myPrefs.rapidfire;
            comboBox2.SelectedIndex = BeastMasterSettings.myPrefs.Readiness;
            comboBox3.SelectedIndex = BeastMasterSettings.myPrefs.murderofcrows;
            comboBox4.SelectedIndex = BeastMasterSettings.myPrefs.BestialWrath;
            comboBox5.SelectedIndex = BeastMasterSettings.myPrefs.berserking;
            comboBox6.SelectedIndex = BeastMasterSettings.myPrefs.bloodfury;
            comboBox7.SelectedIndex = BeastMasterSettings.myPrefs.lifeblood;
            comboBox8.SelectedIndex = BeastMasterSettings.myPrefs.trinket1;
            comboBox9.SelectedIndex = BeastMasterSettings.myPrefs.trinket2;
            comboBox10.SelectedIndex = BeastMasterSettings.myPrefs.engigloves;
            comboBox11.SelectedIndex = BeastMasterSettings.myPrefs.alchemyflask;
            comboBox12.SelectedIndex = BeastMasterSettings.myPrefs.agilityflask;
            comboBox13.SelectedIndex = BeastMasterSettings.myPrefs.virmenpotion;
            comboBox14.SelectedIndex = BeastMasterSettings.myPrefs.misdirection;
            comboBox15.SelectedIndex = BeastMasterSettings.myPrefs.autocallrevivepet;

            comboBoxPauseKey.SelectedIndex = BeastMasterSettings.myPrefs.PauseCRKey;
            switch (BeastMasterSettings.myPrefs.PauseCRKey)
            {
                case 0:
                    BeastMasterSettings.myPrefs.PauseCRKeys = BeastMasterSettings.Keypress.None;
                    break;
                case 1:
                    BeastMasterSettings.myPrefs.PauseCRKeys = BeastMasterSettings.Keypress.LSHIFT;
                    break;
                case 2:
                    BeastMasterSettings.myPrefs.PauseCRKeys = BeastMasterSettings.Keypress.RSHIFT;
                    break;
                case 3:
                    BeastMasterSettings.myPrefs.PauseCRKeys = BeastMasterSettings.Keypress.LCTRL;
                    break;
                case 4:
                    BeastMasterSettings.myPrefs.PauseCRKeys = BeastMasterSettings.Keypress.RCTRL;
                    break;
                case 5:
                    BeastMasterSettings.myPrefs.PauseCRKeys = BeastMasterSettings.Keypress.LALT;
                    break;
                case 6:
                    BeastMasterSettings.myPrefs.PauseCRKeys = BeastMasterSettings.Keypress.RALT;
                    break;
            }
            comboBoxAoePauseKey.SelectedIndex = BeastMasterSettings.myPrefs.AoePauseKey;
            switch (BeastMasterSettings.myPrefs.AoePauseKey)
            {
                case 0:
                    BeastMasterSettings.myPrefs.AoePauseKeys = BeastMasterSettings.Keypress.None;
                    break;
                case 1:
                    BeastMasterSettings.myPrefs.AoePauseKeys = BeastMasterSettings.Keypress.LSHIFT;
                    break;
                case 2:
                    BeastMasterSettings.myPrefs.AoePauseKeys = BeastMasterSettings.Keypress.RSHIFT;
                    break;
                case 3:
                    BeastMasterSettings.myPrefs.AoePauseKeys = BeastMasterSettings.Keypress.LCTRL;
                    break;
                case 4:
                    BeastMasterSettings.myPrefs.AoePauseKeys = BeastMasterSettings.Keypress.RCTRL;
                    break;
                case 5:
                    BeastMasterSettings.myPrefs.AoePauseKeys = BeastMasterSettings.Keypress.LALT;
                    break;
                case 6:
                    BeastMasterSettings.myPrefs.AoePauseKeys = BeastMasterSettings.Keypress.RALT;
                    break;
            }

        }

        private void button1_Click(object sender, EventArgs e)
        {
            BeastMasterSettings.myPrefs.Save();
            Close();
        }

        private void numericUpDownCDNormalMobs_ValueChanged(object sender, EventArgs e)
        {
            BeastMasterSettings.myPrefs.cooldownNormalMobs = (int)numericUpDownCDNormalMobs.Value;
        }

        private void numericUpDownCDBosses_ValueChanged(object sender, EventArgs e)
        {
            BeastMasterSettings.myPrefs.cooldownBosses = (int)numericUpDownCDBosses.Value;
        }

        private void checkBoxMovement_CheckedChanged(object sender, EventArgs e)
        {
            BeastMasterSettings.myPrefs.Movement = checkBoxMovement.Checked;
        }

        private void checkBoxFacing_CheckedChanged(object sender, EventArgs e)
        {
            BeastMasterSettings.myPrefs.Facing = checkBoxFacing.Checked;
        }

        private void checkBoxTargeting_CheckedChanged(object sender, EventArgs e)
        {
            BeastMasterSettings.myPrefs.Targeting = checkBoxTargeting.Checked;
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            BeastMasterSettings.myPrefs.rapidfire = comboBox1.SelectedIndex;
        }

        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            BeastMasterSettings.myPrefs.Readiness = comboBox2.SelectedIndex;
        }

        private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
        {
            BeastMasterSettings.myPrefs.murderofcrows = comboBox3.SelectedIndex;
        }

        private void comboBox4_SelectedIndexChanged(object sender, EventArgs e)
        {
            BeastMasterSettings.myPrefs.BestialWrath = comboBox4.SelectedIndex;
        }

        private void comboBox5_SelectedIndexChanged(object sender, EventArgs e)
        {
            BeastMasterSettings.myPrefs.berserking = comboBox5.SelectedIndex;
        }

        private void comboBox6_SelectedIndexChanged(object sender, EventArgs e)
        {
            BeastMasterSettings.myPrefs.bloodfury = comboBox6.SelectedIndex;
        }

        private void comboBox7_SelectedIndexChanged(object sender, EventArgs e)
        {
            BeastMasterSettings.myPrefs.lifeblood = comboBox7.SelectedIndex;
        }

        private void comboBox8_SelectedIndexChanged(object sender, EventArgs e)
        {
            BeastMasterSettings.myPrefs.trinket1 = comboBox8.SelectedIndex;
        }

        private void comboBox9_SelectedIndexChanged(object sender, EventArgs e)
        {
            BeastMasterSettings.myPrefs.trinket2 = comboBox9.SelectedIndex;
        }

        private void comboBox10_SelectedIndexChanged(object sender, EventArgs e)
        {
            BeastMasterSettings.myPrefs.engigloves = comboBox10.SelectedIndex;
        }

        private void comboBox11_SelectedIndexChanged(object sender, EventArgs e)
        {
            BeastMasterSettings.myPrefs.alchemyflask = comboBox11.SelectedIndex;
        }

        private void comboBox12_SelectedIndexChanged(object sender, EventArgs e)
        {
            BeastMasterSettings.myPrefs.agilityflask = comboBox12.SelectedIndex;
        }

        private void comboBox13_SelectedIndexChanged(object sender, EventArgs e)
        {
            BeastMasterSettings.myPrefs.virmenpotion = comboBox13.SelectedIndex;
        }

        private void comboBox14_SelectedIndexChanged(object sender, EventArgs e)
        {
            BeastMasterSettings.myPrefs.misdirection = comboBox14.SelectedIndex;
        }

        private void comboBox15_SelectedIndexChanged(object sender, EventArgs e)
        {
            BeastMasterSettings.myPrefs.autocallrevivepet = comboBox15.SelectedIndex;
        }

        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            BeastMasterSettings.myPrefs.UseSilencingShot = checkBox1.Checked;
        }

        private void numericUpDown1_ValueChanged(object sender, EventArgs e)
        {
            BeastMasterSettings.myPrefs.callpetnr = (int)numericUpDown1.Value;
        }

        private void numericUpDown2_ValueChanged(object sender, EventArgs e)
        {
            BeastMasterSettings.myPrefs.mendpetpercent = (int)numericUpDown2.Value;
        }

        private void numericUpDown3_ValueChanged(object sender, EventArgs e)
        {
            BeastMasterSettings.myPrefs.ElitesHealth = (int)numericUpDown3.Value;
        }

        private void numericUpDown4_ValueChanged(object sender, EventArgs e)
        {
            BeastMasterSettings.myPrefs.healthstonepercent = (int)numericUpDown4.Value;
        }

        private void numericUpDown5_ValueChanged(object sender, EventArgs e)
        {
            BeastMasterSettings.myPrefs.naruupercent = (int)numericUpDown5.Value;
        }

        private void numericUpDown6_ValueChanged(object sender, EventArgs e)
        {
            BeastMasterSettings.myPrefs.EatFood = (int)numericUpDown6.Value;
        }

        private void comboBoxPauseKey_SelectedIndexChanged(object sender, EventArgs e)
        {
            BeastMasterSettings.myPrefs.PauseCRKey = comboBoxPauseKey.SelectedIndex;
            switch (comboBoxPauseKey.SelectedIndex)
            {
                case 0:
                    BeastMasterSettings.myPrefs.PauseCRKeys = BeastMasterSettings.Keypress.None;
                    break;
                case 1:
                    BeastMasterSettings.myPrefs.PauseCRKeys = BeastMasterSettings.Keypress.LSHIFT;
                    break;
                case 2:
                    BeastMasterSettings.myPrefs.PauseCRKeys = BeastMasterSettings.Keypress.RSHIFT;
                    break;
                case 3:
                    BeastMasterSettings.myPrefs.PauseCRKeys = BeastMasterSettings.Keypress.LCTRL;
                    break;
                case 4:
                    BeastMasterSettings.myPrefs.PauseCRKeys = BeastMasterSettings.Keypress.RCTRL;
                    break;
                case 5:
                    BeastMasterSettings.myPrefs.PauseCRKeys = BeastMasterSettings.Keypress.LALT;
                    break;
                case 6:
                    BeastMasterSettings.myPrefs.PauseCRKeys = BeastMasterSettings.Keypress.RALT;
                    break;
            }
        }

        private void comboBoxAoePauseKey_SelectedIndexChanged(object sender, EventArgs e)
        {
            BeastMasterSettings.myPrefs.AoePauseKey = comboBoxAoePauseKey.SelectedIndex;
            switch (comboBoxAoePauseKey.SelectedIndex)
            {
                case 0:
                    BeastMasterSettings.myPrefs.AoePauseKeys = BeastMasterSettings.Keypress.None;
                    break;
                case 1:
                    BeastMasterSettings.myPrefs.AoePauseKeys = BeastMasterSettings.Keypress.LSHIFT;
                    break;
                case 2:
                    BeastMasterSettings.myPrefs.AoePauseKeys = BeastMasterSettings.Keypress.RSHIFT;
                    break;
                case 3:
                    BeastMasterSettings.myPrefs.AoePauseKeys = BeastMasterSettings.Keypress.LCTRL;
                    break;
                case 4:
                    BeastMasterSettings.myPrefs.AoePauseKeys = BeastMasterSettings.Keypress.RCTRL;
                    break;
                case 5:
                    BeastMasterSettings.myPrefs.AoePauseKeys = BeastMasterSettings.Keypress.LALT;
                    break;
                case 6:
                    BeastMasterSettings.myPrefs.AoePauseKeys = BeastMasterSettings.Keypress.RALT;
                    break;
            }
        }

        private void numericUpDown7_ValueChanged(object sender, EventArgs e)
        {
            BeastMasterSettings.myPrefs.startaoe = (int)numericUpDown7.Value;
        }
    }
}
